<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@include file="/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<fmt:bundle basename="res">
<head>
    <meta charset="utf-8">
    <title><fmt:message key='lb'/></title>
    <jsp:include page="/WEB-INF/commons/commons-header.jsp" flush="true"/>
</head>
<body>


<body >
<div class="layui-container">
<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">

    <form:form commandName="brand" method="put" class="layui-form" id="form">
        <input type="hidden" name="_method" value="put"/>
        <form:hidden path="id"/>
        <div class="layui-form-item">
            <label class="layui-form-label"> <fmt:message key='ppmc'/></label>
            <div class="layui-form-mid layui-word-aux">
                ${brand.name}
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"> <fmt:message key='pplogo'/></label>
            <div class="layui-form-mid layui-word-aux">
                <c:if test="${not empty brand.logo}">
                    <img class="preview" src="${store_domain}/uploads/${brand.logo}" style="width:120px;height:120px;margin-top:10px;">
                </c:if>
                <c:if test="${empty brand.logo}">
                    <img src="${web_domain}/resources/images/default.jpeg" style="width:120px;height:120px;margin-top:10px;">
                </c:if>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"><fmt:message key='bz'/></label>
            <div class="layui-form-mid layui-word-aux">
                ${brand.note}
            </div>
        </div>

        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend><fmt:message key='shxx'/></legend>
        </fieldset>

        <div class="layui-form-item">
            <label class="layui-form-label"><fmt:message key='shzt'/></label>
            <div class="layui-form-mid layui-word-aux">
                <c:choose>
                    <c:when test="${brand.status eq 2}"><fmt:message key='shz'/></c:when>
                    <c:when test="${brand.status eq 3}"><fmt:message key='shtg'/></c:when>
                    <c:when test="${brand.status eq 4}"><fmt:message key='shbtg'/></c:when>
                </c:choose>
            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label"> <fmt:message key='shjg'/></label>
            <div class="layui-input-inline" style="width:70%;">
                <input type="radio" name="status" lay-filter="status" lay-verify="required" value="3" title="<fmt:message key='shtg'/>" <c:if test="${brand.status eq 3}">checked="checked"</c:if>/>
                <input type="radio" name="status" lay-filter="status" lay-verify="required" value="4" title="<fmt:message key='shbtg'/>" <c:if test="${brand.status eq 4}">checked="checked"</c:if>/>
            </div>
        </div>

        <div class="layui-form-item feijin-fail" style="display:none;">
            <label class="layui-form-label"><b style="color:red">*</b> <fmt:message key='bz'/></label>
            <div class="layui-input-inline">
                <form:textarea path="note" class="layui-textarea" style="height:100px;width:100%"/>
            </div>
        </div>

        <div class="layui-input-block">
            <div style="display: none"><input type="button" value="<fmt:message key='bc'/>" class="layui-btn" id="submit" lay-filter="submit" lay-submit></div>
        </div>

    </form:form>
</div>
</div>

<div style="display: none;">
    <form action="${web_domain}/upload/image" method="post" id="uploadImage" enctype="multipart/form-data">
        <input id="uploadImageFile" name="file" type="file" accept="image/*"/>
    </form>
</div>

<script>
    $(function () {

        layui.use(['form', 'laydate'], function () {

            var form = layui.form;
            var laydate = layui.laydate;

            form.on('submit(submit)', function (data) {

                $("#form").ajaxSubmit({
                    success: function (result) {
                        if (result.status) {
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                            parent.$("#search").click();
                        } else {
                            layui.use('layer', function () {
                                layer.msg(result.message);
                            });
                        }
                    }
                });
            });

        });

    });
</script>
</body>
</fmt:bundle>
</html>